package com.bytearch.fastcloud.boot.order.contants;

import com.bytearch.fastcloud.boot.order.enums.ResultCodeEnum;

/**
 * 返回结果类
 *
 * @param <T>
 */
public class ResultDTO<T> {
    /**
     * 返回状态码
     */
    private Integer code;
    /**
     * 返回提示信息
     */
    private String msg;
    /**
     * 返回数据
     */
    private T data;

    public ResultDTO() {
        this.code = ResultCodeEnum.SUCCESS.getCode();
        this.msg = ResultCodeEnum.SUCCESS.getMsg();
    }

    public ResultDTO(Integer code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }


    public ResultDTO(ResultCodeEnum resultCodeEnum) {
        this(resultCodeEnum.getCode(), resultCodeEnum.getMsg(), null);
    }

    public ResultDTO(ResultCodeEnum resultCodeEnum, T data) {
        this(resultCodeEnum.getCode(), resultCodeEnum.getMsg(), data);
    }
}
